﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mmoss.classes.Interfaces;

namespace mmoss.classes
{
    public class CCCard : IScannedCard
    {
        public string USBScanString { get; set; }
        public string FirstName { get; set; }
        public string MiddleName { get; set; }
        public string LastName { get; set; }
        public string CardNumber { get; set; }
        public DateTime ExpDate { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string ParseError { get; set; }
        public DateTime DOB { get; set; }
        public CCCard()
        {
        }
        public CCCard(string sParseInfo)
        {
            try
            {
                sParseInfo = sParseInfo.Replace("%B", string.Empty);
                CardNumber = sParseInfo.Split('^')[0];
                LastName = sParseInfo.Split('^')[1].Split('/')[0];
                FirstName = sParseInfo.Split('^')[1].Split('/')[1].Trim();
                ExpDate = DateTime.Parse(string.Format("{0}/{1}", sParseInfo.Split('^')[2].Substring(0, 2), sParseInfo.Split('^')[2].Substring(2, 2)));
            }
            catch (Exception ex)
            {
                ParseError = ex.Message;
            }
        }
    }
}
